//
//  AssistImgCell.swift
//  ANOA
//
//  Created by 邱仙凯 on 2019/7/16.
//  Copyright © 2019 zwb. All rights reserved.
//

import UIKit

class AssistImgCell: BaseTicketCell ,KSImageUtilDelegate {
    func addImages(_ util: KSImageSelectUtil, imgs: [UIImage]) {
        self.addAction!(imgs)
    }
    
    func deleteImage(_ util: KSImageSelectUtil, index: Int) {
        self.deleteAction!(index)
        self.imageUtil?.deleteLocalImg(tag: index)
    }
    func addFiles(_ util: KSImageSelectUtil, files: [VideoImg]) {
        self.addFileAction!(files)
    }
 
   
     var imageUtil:KSImageSelectUtil?
    var addFileAction:(([VideoImg])->())?
    var deleteAction:((Int)->())?
     var addAction:(([UIImage])->())?
    var viewOnly = false {
        didSet {
            let viewFlag:ImgViewType = viewOnly ? .viewOnly : .editable

            
            imageUtil = KSImageSelectUtil(frame: CGRect(x:0,y:5,width:bgW ,height:110),httpHeader: USERINFO.picUrl.unwrap,maxImgCount: 4,numberOfRow: 4,picType: [.takePicture,.albumPicture,.pdfFile],viewType:viewFlag)
            imageUtil!.ksDelegate = self
            imageUtil!.setLineHidden(true)
            bg.addSubview(imageUtil!)
        }
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        setLineHidden(true)
       
    }
 
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
   
    
}


